﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Web.Configuration;
using System.Data;

namespace TRAVEL11
{
    public partial class Search1 : System.Web.UI.UserControl
    {
        static string strconn = WebConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString;

        protected void Page_Load(object sender, EventArgs e)
        {
            string query2 = "select LocationId,Country,LocationName from dbo.SYS_tblLocation where STATUS like N'Kích hoạt'";

            SqlConnection conn = new SqlConnection(strconn);
            conn.Open();

            SqlDataAdapter da2 = new SqlDataAdapter(query2, conn);

            DataSet ds2 = new DataSet();

            da2.Fill(ds2);

            //DDList Dia Diem Xuat Phat
            NoiDi.DataSource = ds2;
            NoiDi.DataValueField = "LocationId";
            NoiDi.DataTextField = "LocationName";
            NoiDi.DataBind();

            //DDList Dia Diem Cuoi
            NoiDen.DataSource = ds2;
            NoiDen.DataValueField = "LocationId";
            NoiDen.DataTextField = "LocationName";
            NoiDen.DataBind();

            conn.Close();
        }
        
        protected void search_bt_Click(object sender, EventArgs e)
        {
            int trongNuoc = 0;
            int ngoaiNuoc = 0;
            string noiDi = NoiDi.Text;
            string noiDen = NoiDen.Text;
            string giaVe = GiaVe.Text;
            string loaiTour = LoaiTour.Text;
            string ngay = Ngay.Text;
            string thang = Thang.Text;
            string nam = Nam.Text;
            string url;
            
            url = "Search_Result.aspx?noiDi="+noiDi+ "&noiDen="+noiDen+ "&giaVe="+giaVe+ "&loaiTour="+loaiTour+ 
                "&ngay="+ngay+ "&thang="+thang+ "&nam="+nam;

            Response.Redirect(url);
        }
       
    }
}